﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MetroStyle
{
    public partial class FormSizeable : UserControl
    {
        public FormSizeable()
        {
            InitializeComponent();
        }
        public System.Windows.Forms.Form MainForm { get; set; }
        bool sizeable = false;
        Point p;
        private void btn_size_MouseMove(object sender, MouseEventArgs e)
        {
            if (sizeable)
            {
                Point temp = Cursor.Position;
                MainForm.Size = new Size(MainForm.Width + (temp.X - p.X), MainForm.Height + (temp.Y - p.Y));
                p = temp;
            }
        }

        private void btn_size_MouseUp(object sender, MouseEventArgs e)
        {
            sizeable = false;
        }

        private void btn_size_MouseDown(object sender, MouseEventArgs e)
        {
            sizeable = true;
            p = Cursor.Position;
        }
    }
}
